# -*- coding:utf-8 -*-

import unittest, requests, json, os, time, logging
from os import path
from common.ReadConfig import ReadConfig
from common.HTMLTestRunner import HTMLTestRunner
import common.NewReport as nr
import common.CommonPath as cp
import common.ReportName as rn
import common.RunCase as rc
from common.SendMail import SendMail

# 执行的用例名
rule = str(ReadConfig().get_case('case'))


def add_case(case_path=cp.case_path, rule=rule):
    discover = unittest.defaultTestLoader.discover(case_path,
                                                   pattern=rule,
                                                   top_level_dir=None)
    return discover


if __name__ == '__main__':
    cases = add_case()
    filename = nr.new_report()
    rc.run_case(cases)
    # SendMail().send_mail(filename)
